xlv.obj.googleApi={
	extend:function(){
	},
	implement:function(){
		this.implement('xlv.imp.mvc');
	},
	create:function(tag){
		var div=document.createElement((tag||'div'));
		div.setAttribute('xlvobject','xlv.obj.googleApi');
		return div;			
	},
	properties:{
		api:'visualization', //(maps,2)search,feeds,language,earth,friendconnect,orkut,visualization
		version:'1', 
		packages:['corechart'],
		dmName:null
	},
	method:{
		construct:function(){
			xlv.google.jsApi();
		},
		_loadApi:function(){
			if(xlv.google.jsApiLoaded){
				var options={'callback' : function(){this._apiReady();}.bind(this)};
				if(this.$P.packages) options.packages=this.$P.packages;
				google.load(this.$P.api, this.$P.version, options);
			}else xlv.google.jsApi(function(){this._loadApi();}.bind(this));
		},
		initial:function(){
			this._loadApi();
		},
		isApiReady:function(){
			return this.$V.googleApiReady;
		},
		_apiReady:function(){
			this.$V.googleApiReady=true;
			var dm;
			if(this.$P.dmName){
				dm=this.getDataModel();
				if(dm && !dm.responsed()) return;
			}	
			this.mvc_modelToView(dm);
		},
		mvc_modelToView:function(dm){
			if(!this.isApiReady()) return;
			var dm=(dm||this.mvc_getModel());
			if(dm)this.mvc_valueToView(this.mvc_valueFromModel(dm));
		}

	}
};
